﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GameSchool.Models
{
    public interface IGameSchoolRepository
    {
		/*	Achievement repository  */
        IQueryable<Achievement> Achievements();
        IEnumerable<Achievement> GetAchievements();
        IEnumerable<Achievement> GetAchievements(int id);
        IEnumerable<Achievement> GetAchievementsForStudent(Student theStudent);
        void AddAchievement(Achievement theAchievement);
        void UpdateAchievement(int id);
        void DeleteAchievement(int id);



		/*	Student repository  */
        IQueryable<Student> Students();
        IEnumerable<Student> GetStudents();
        IEnumerable<Student> GetStudents(int id);
        void AddStudent(Student theStudent);
        Student GetStudentLoginRelationship();
        void UpdateStudent(int id);
        void DeleteStudent(int id);


		/*	Courses repository  */
        IQueryable<Course> Courses();
		IEnumerable <Course> GetCourses();
        Course GetCourseByID(int id);
		void AddCourse(Course theCourse);
        IEnumerable<Course> GetCoursesByStudent(Student theStudent);
		void UpdateCourse(int id);
 		void DeleteCourse(int id);

		
		/*	Teacher repository  */
        IQueryable<Teacher> Teachers();		
		IEnumerable<Teacher> GetTeachers();
		Teacher GetTeachers(int id);
		void AddTeacher(Teacher theTeacher);
		void UpdateTeacher(int id);
		void DeleteTeacher(int id);

		/*	Level repository  */
        IQueryable<Level> Levels();
        IEnumerable<Level> GetLevels();
        IEnumerable<Level> GetLevels(int id);
        IEnumerable<Level> GetAllLevelsByCourse(Course theCourse);
        IEnumerable<Level> GetUnlockedLevelsByStudentAndCourse(Student theStudent, Course theCourse);
        void AddLevel(Level theLevel);
        void UpdateLevel(int id);
        void DeleteLevel(int id);

		/*	Exam repository  */
        IQueryable<Exam> Exams();
        IEnumerable<Exam> GetExams();
        IEnumerable<Exam> GetExam(int id);
        IEnumerable<Exam> GetExamsByLevel(Level theLevel);
        void UpdateExam(Exam theExam);
        void DeleteExam(int id);

		/*	Assignment repository  */
        IQueryable<Assignment> Assignments();
        Assignment GetAssignmentByID(int id);
        IEnumerable<Assignment> getAssignments();
        IEnumerable<Assignment> getAssignments(int id); // gets all assignments that have ids that are less than "id". We need this for AJAX.
        IEnumerable<Assignment> GetAssignmentsByLevel(Level theLevel);
        int getAssignmentXP(int id); 
        void addAssignment(Assignment theAssignment);
        void UpdateAssignment(Assignment theAssignment);
        void deleteAssignment(int id);

		/*	Lecture repository  */
        IQueryable<Lecture> Lectures();
        IEnumerable<Lecture> GetLectures();
        IEnumerable<Lecture> GetLectures(int id);
        IEnumerable<Lecture> GetLecturesByLevel(Level theLevel);
        void UpdateLecture(Lecture theLecture);
        void DeleteLecture(int id);


		/*	Question repository  */
        IQueryable<Question> Questions();
        IEnumerable<Question> GetQuestions();
        IEnumerable<Question> GetQuestions(int id);
        void AddQuestion(Question theQuestion);
        void UpdateQuestion(int id);
        void DeleteQuestion(int id);


		/*	Answer repository  */
        IQueryable<Answer> Answers();
        IEnumerable<Answer> GetAnswers();
        IEnumerable<Answer> GetAnswers(int id);
        void AddAnswer(Answer theAnswer);
        void UpdateAnswer(int id);
        void DeleteAnswer(int id);



		/*	Comment repository  */
        IQueryable<Comment> Comments();
        IEnumerable<Comment> GetComments();
        IEnumerable<Comment> GetComments(int id);
        void AddComment(Comment theComment);
        void UpdateComment(int id);
        void DeleteComment(int id);

		/*	Like repository  */
        IQueryable<Like> Likes();
        int GetLikes(int commentID);
        void AddLike(int studentID, int commentID);

        /* TeacherCourse repository */
        IQueryable<TeacherCourse> TeacherCourses();
        void AddTeacherCourse(int theCourseID, int theTeacherID);
        TeacherCourse GetTeacherCourse(int theCourseID, int theTeacherID);

        /*StudentCourse repository */
        IQueryable<StudentCourse> StudentCourses();
        void AddStudentCourse(int theCourseID, int theStudentID);
        StudentCourse GetStudentCourse(int theCourseID, int theStudentID);

        /*CourseAchievement repository */
        void AddCourseAchievement(Course theCourse, Achievement theAchievement);

        /* save */
        void Save();

        int getXPofStudentAbove(int theCourseID, int theStudentID);
        int getXPofStudentBelow(int theCourseID, int theStudentID);

        void addStudentAssignment(StudentAssignment stuAss);


        IEnumerable<Assignment> GetAssignmentByCourseID(int theCourseID);

        IEnumerable<Course> GetCourses(int id);

        IEnumerable<Student> GetStudentsInCourse(Course theCourse);

        IEnumerable<Teacher> GetTeachersInCourse(Course theCourse);

    }

}
